package aybolit.core.objects.model;

import javax.persistence.Entity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 13.03.13
 * Time: 16:57
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Chambers implements Serializable {
    private int chamberId;

    @javax.persistence.Column(name = "chamber_id")
    @javax.persistence.Id
    public int getChamberId() {
        return chamberId;
    }

    public void setChamberId(int chamberId) {
        this.chamberId = chamberId;
    }

    private int departamentId;

    @javax.persistence.Column(name = "departament_id")
    @javax.persistence.Basic
    public int getDepartamentId() {
        return departamentId;
    }

    public void setDepartamentId(int departamentId) {
        this.departamentId = departamentId;
    }

    private int chamberTypeId;

    @javax.persistence.Column(name = "chamber_type_id")
    @javax.persistence.Basic
    public int getChamberTypeId() {
        return chamberTypeId;
    }

    public void setChamberTypeId(int chamberTypeId) {
        this.chamberTypeId = chamberTypeId;
    }

    private int chamberStatusId;

    @javax.persistence.Column(name = "chamber_status_id")
    @javax.persistence.Basic
    public int getChamberStatusId() {
        return chamberStatusId;
    }

    public void setChamberStatusId(int chamberStatusId) {
        this.chamberStatusId = chamberStatusId;
    }

    private String name;

    @javax.persistence.Column(name = "name")
    @javax.persistence.Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String note;

    @javax.persistence.Column(name = "note")
    @javax.persistence.Basic
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    private Timestamp timestamp;

    @javax.persistence.Column(name = "timestamp_")
    @javax.persistence.Basic
    public Timestamp getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Timestamp timestamp) {
        this.timestamp = timestamp;
    }

    private int deleted;

    @javax.persistence.Column(name = "deleted")
    @javax.persistence.Basic
    public int getDeleted() {
        return deleted;
    }

    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Chambers chambers = (Chambers) o;

        if (chamberId != chambers.chamberId) return false;
        if (chamberStatusId != chambers.chamberStatusId) return false;
        if (chamberTypeId != chambers.chamberTypeId) return false;
        if (deleted != chambers.deleted) return false;
        if (departamentId != chambers.departamentId) return false;
        if (name != null ? !name.equals(chambers.name) : chambers.name != null) return false;
        if (note != null ? !note.equals(chambers.note) : chambers.note != null) return false;
        if (timestamp != null ? !timestamp.equals(chambers.timestamp) : chambers.timestamp != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = chamberId;
        result = 31 * result + departamentId;
        result = 31 * result + chamberTypeId;
        result = 31 * result + chamberStatusId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (note != null ? note.hashCode() : 0);
        result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0);
        result = 31 * result + deleted;
        return result;
    }

    private Collection<Beds> bedsesByChamberId;

    @javax.persistence.OneToMany(mappedBy = "chambersByChamberId")
    public Collection<Beds> getBedsesByChamberId() {
        return bedsesByChamberId;
    }

    public void setBedsesByChamberId(Collection<Beds> bedsesByChamberId) {
        this.bedsesByChamberId = bedsesByChamberId;
    }

    private Departments departmentsByDepartamentId;

    @javax.persistence.ManyToOne
    public
    @javax.persistence.JoinColumn(name = "departament_id", referencedColumnName = "department_id", nullable = false, table = "chambers")
    Departments getDepartmentsByDepartamentId() {
        return departmentsByDepartamentId;
    }

    public void setDepartmentsByDepartamentId(Departments departmentsByDepartamentId) {
        this.departmentsByDepartamentId = departmentsByDepartamentId;
    }

    private Status statusByChamberStatusId;

    @javax.persistence.ManyToOne
    public
    @javax.persistence.JoinColumn(name = "chamber_status_id", referencedColumnName = "status_id", nullable = false, table = "chambers")
    Status getStatusByChamberStatusId() {
        return statusByChamberStatusId;
    }

    public void setStatusByChamberStatusId(Status statusByChamberStatusId) {
        this.statusByChamberStatusId = statusByChamberStatusId;
    }

    private Types typesByChamberTypeId;

    @javax.persistence.ManyToOne
    public
    @javax.persistence.JoinColumn(name = "chamber_type_id", referencedColumnName = "type_id", nullable = false, table = "chambers")
    Types getTypesByChamberTypeId() {
        return typesByChamberTypeId;
    }

    public void setTypesByChamberTypeId(Types typesByChamberTypeId) {
        this.typesByChamberTypeId = typesByChamberTypeId;
    }
}
